package sys.tests.logic;

import sys.message.*;
import sys.transport.*;
import sys.database.*;

public class Test2
{
    public static void startTest(String mailServer, String sysaAddress, String DBHost, String DBName, String user, String pass)
    { 
/*        System.out.println("-------------------------------------------------------------");*/
        //System.out.println("Test2 : User sends nack");
        //System.out.println("-------------------------------------------------------------");

        //DBWrapper dbw = new DBWrapper(DBHost, DBName, user, pass);
        //dbw.connect();
        //dbw.delete("Request", "ID = 1");
        //dbw.disconnect();

        //UniMessage mes = null; 
        //try
        //{
            //Новый запрос к системе B
            //mes = new JSONMessage(sysaAddress, "systemb@localhost.localdomain", "LOGIC TEST 1");
            //mes.put("Type", "newRequest");
            //mes.put("ID", 0);
            //mes.put("Quantity", 10);
            //mes.put("UserName", "user_1");
            //mes.put("PayingSystem", "systemc@localhost.localdomain");
            //new MessageSenderSMTP(mailServer).send(mes);

            //Thread.sleep(2000);
            //Подтверждение от системы оплаты 
            //mes = new JSONMessage("systemc@localhost.localdomain", "systemb@localhost.localdomain", "LOGIC TEST 2");
            //mes.put("Type", "ackPayingSystem");
            //mes.put("ackOn", 1);
            //new MessageSenderSMTP(mailServer).send(mes);

            //Thread.sleep(15000);
            //Nack от системы заказчика
            //mes = new JSONMessage("systema@localhost.localdomain", "systemb@localhost.localdomain", "LOGIC TEST 2");
            //mes.put("Type", "nackBuyer");
            //mes.put("nackOn", 1);
            //new MessageSenderSMTP(mailServer).send(mes);

            //Thread.sleep(3000);
            //Nack от системы заказчика
            //mes = new JSONMessage("systema@localhost.localdomain", "systemb@localhost.localdomain", "LOGIC TEST 2");
            //mes.put("Type", "nackBuyer");
            //mes.put("nackOn", 1);
            //new MessageSenderSMTP(mailServer).send(mes);

            //Thread.sleep(30000);
        //}
        //catch (Exception e)
        //{
            //System.out.println("Test2: Something wrong " + e.getMessage());
        /*}*/
    }
}
